<template>
  <div class="home">
   <ul>
    <li v-for="(item,index) in list" :key="index">{{item}}</li>
   </ul>
  </div>
</template>

<script>
// @ is an alias to /src
// import bus from '../utils/bus'
import api from '../api/index'
export default {
  name: 'HomeView',
  components: {
  },
  data(){
    return {
      list:["日照香炉生紫烟","遥看瀑布挂前川","飞流直下三千尺","疑是银河落九天"]
    }
  },
  created() {
    api.get('/cms/news/list').then(res => {
      console.log(res);
    })
  },
  mounted() {
    this.$bus.$on('search',this.searchHome)
  },
  methods: {
    searchHome(val){
       this.list = this.list.filter(item => item.includes(val))
    }
  },
}
</script>
